#-*- codeing = utf-8 -*-
#@Time : 2020/9/13 13:49
#@Author : 阳某
#@File : selenium的其它操作.py
#@Software : PyCharm
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get('https://www.taobao.com')
# 标签定位
search_input = driver.find_element_by_id('q')
# 标签交互
search_input.send_keys('Iphone')

# 执行一组js代码
driver.execute_script('window.scrollTo(0,document.body.scrollHeight)')      #滚轮向下滚动一屏的高度
time.sleep(2)
# 点击搜索按钮
btn = driver.find_element_by_class_name('btn-search')
btn.click()
driver.get('https://www.baidu.com')
time.sleep(2)

driver.back()   #回退
time.sleep(2)

driver.forward()   #前进
time.sleep(2)

time.sleep(5)
driver.quit()